home *** CD-ROM | disk | FTP | other *** search
/ Hardcore Visual Basic 5.0 (2nd Edition) / Hardcore Visual Basic 5.0 - Second Edition (1997)(Microsoft Press).iso / Source / WinTlb / SHLOBJ.IDL < prev    next >
Text File  |  1997-05-27  |  76KB  |  1,984 lines

  1. //===========================================================================
  2. //
  3. // Copyright (c) Microsoft Corporation 1991-1996
  4. //
  5. // File: shlobj.h
  6. //
  7. //===========================================================================
  8.  
  9. #ifndef _PRSHT_H_
  10. //#include "prsht.idl"
  11. #endif
  12.  
  13. #ifndef INITGUID
  14. //#include "shlguid.h"
  15. #endif // !INITGUID
  16.  
  17. //===========================================================================
  18. //
  19. // Object identifiers in the explorer's name space (ItemID and IDList)
  20. //
  21. //  All the items that the user can browse with the explorer (such as files,
  22. // directories, servers, work-groups, etc.) has an identifier which is unique
  23. // among items within the parent folder. Those identifiers are called item
  24. // IDs (SHITEMID). Since all its parent folders have their own item IDs,
  25. // any items can be uniquely identified by a list of item IDs, which is called
  26. // an ID list (ITEMIDLIST).
  27. //
  28. //  ID lists are almost always allocated by the task allocator (see some
  29. // description below as well as OLE 2.0 SDK) and may be passed across
  30. // some of shell interfaces (such as IShellFolder). Each item ID in an ID list
  31. // is only meaningful to its parent folder (which has generated it), and all
  32. // the clients must treat it as an opaque binary data except the first two
  33. // bytes, which indicates the size of the item ID.
  34. //
  35. //  When a shell extension -- which implements the IShellFolder interace --
  36. // generates an item ID, it may put any information in it, not only the data
  37. // with that it needs to identifies the item, but also some additional
  38. // information, which would help implementing some other functions efficiently.
  39. // For example, the shell's IShellFolder implementation of file system items
  40. // stores the primary (long) name of a file or a directory as the item
  41. // identifier, but it also stores its alternative (short) name, size and date
  42. // etc.
  43. //
  44. //  When an ID list is passed to one of shell APIs (such as SHGetPathFromIDList),
  45. // it is always an absolute path -- relative from the root of the name space,
  46. // which is the desktop folder. When an ID list is passed to one of IShellFolder
  47. // member function, it is always a relative path from the folder (unless it
  48. // is explicitly specified).
  49. //
  50. //===========================================================================
  51.  
  52. //
  53. // SHITEMID -- Item ID
  54. //
  55. typedef struct SHITEMID        // mkid
  56. {
  57.     USHORT      cb;             // Size of the ID (including cb itself)
  58.     BYTE        abID[1];        // The item ID (variable length)
  59. } SHITEMID;
  60. typedef UNALIGNED SHITEMID *LPSHITEMID;
  61. typedef const UNALIGNED SHITEMID *LPCSHITEMID;
  62. //
  63. // ITEMIDLIST -- List if item IDs (combined with 0-terminator)
  64. //
  65. typedef struct ITEMIDLIST      // idl
  66. {
  67.     SHITEMID    mkid;
  68. } ITEMIDLIST;
  69.  
  70. // typedef UNALIGNED ITEMIDLIST * LPITEMIDLIST;
  71. // typedef const UNALIGNED ITEMIDLIST * LPCITEMIDLIST;
  72. typedef LONG LPITEMIDLIST;
  73. typedef LONG LPCITEMIDLIST;
  74.  
  75. //===========================================================================
  76. //
  77. // Task allocator API
  78. //
  79. //  All the shell extensions MUST use the task allocator (see OLE 2.0
  80. // programming guild for its definition) when they allocate or free
  81. // memory objects (mostly ITEMIDLIST) that are returned across any
  82. // shell interfaces. There are two ways to access the task allocator
  83. // from a shell extension depending on whether or not it is linked with
  84. // OLE32.DLL or not (purely for efficiency).
  85. //
  86. // (1) A shell extension which calls any OLE API (i.e., linked with
  87. //  OLE32.DLL) should call OLE's task allocator (by retrieving
  88. //  the task allocator by calling CoGetMalloc API).
  89. //
  90. // (2) A shell extension which does not call any OLE API (i.e., not linked
  91. //  with OLE32.DLL) should call the shell task allocator API (defined
  92. //  below), so that the shell can quickly loads it when OLE32.DLL is not
  93. //  loaded by any application at that point.
  94. //
  95. // Notes:
  96. //  In next version of Windowso release, SHGetMalloc will be replaced by
  97. // the following macro.
  98. //
  99. // define SHGetMalloc(ppmem)   CoGetMalloc(MEMCTX_TASK, ppmem)
  100. //
  101. //===========================================================================
  102.  
  103. //===========================================================================
  104. //
  105. // IContextMenu interface
  106. //
  107. // [OverView]
  108. //
  109. //  The shell uses the IContextMenu interface in following three cases.
  110. //
  111. // case-1: The shell is loading context menu extensions.
  112. //
  113. //   When the user clicks the right mouse button on an item within the shell's
  114. //  name space (i.g., file, directory, server, work-group, etc.), it creates
  115. //  the default context menu for its type, then loads context menu extensions
  116. //  that are registered for that type (and its base type) so that they can
  117. //  add extra menu items. Those context menu extensions are registered at
  118. //  HKCR\{ProgID}\shellex\ContextMenuHandlers.
  119. //
  120. // case-2: The shell is retrieving a context menu of sub-folders in extended
  121. //   name-space.
  122. //
  123. //   When the explorer's name space is extended by name space extensions,
  124. //  the shell calls their IShellFolder::GetUIObjectOf to get the IContextMenu
  125. //  objects when it creates context menus for folders under those extended
  126. //  name spaces.
  127. //
  128. // case-3: The shell is loading non-default drag and drop handler for directories.
  129. //
  130. //   When the user performed a non-default drag and drop onto one of file
  131. //  system folders (i.e., directories), it loads shell extensions that are
  132. //  registered at HKCR\{ProgID}\DragDropHandlers.
  133. //
  134. //
  135. // [Member functions]
  136. //
  137. //
  138. // IContextMenu::QueryContextMenu
  139. //
  140. //   This member function may insert one or more menuitems to the specified
  141. //  menu (hmenu) at the specified location (indexMenu which is never be -1).
  142. //  The IDs of those menuitem must be in the specified range (idCmdFirst and
  143. //  idCmdLast). It returns the maximum menuitem ID offset (ushort) in the
  144. //  'code' field (low word) of the scode.
  145. //
  146. //   The uFlags specify the context. It may have one or more of following
  147. //  flags.
  148. //
  149. //  CMF_DEFAULTONLY: This flag is passed if the user is invoking the default
  150. //   action (typically by double-clicking, case 1 and 2 only). Context menu
  151. //   extensions (case 1) should not add any menu items, and returns NOERROR.
  152. //
  153. //  CMF_VERBSONLY: The explorer passes this flag if it is constructing
  154. //   a context menu for a short-cut object (case 1 and case 2 only). If this
  155. //   flag is passed, it should not add any menu-items that is not appropriate
  156. //   from a short-cut.
  157. //    A good example is the "Delete" menuitem, which confuses the user
  158. //   because it is not clear whether it deletes the link source item or the
  159. //   link itself.
  160. //
  161. //  CMF_EXPLORER: The explorer passes this flag if it has the left-side pane
  162. //   (case 1 and 2 only). Context menu extensions should ignore this flag.
  163. //
  164. //   High word (16-bit) are reserved for context specific communications
  165. //  and the rest of flags (13-bit) are reserved by the system.
  166. //
  167. //
  168. // IContextMenu::InvokeCommand
  169. //
  170. //   This member is called when the user has selected one of menuitems that
  171. //  are inserted by previous QueryContextMenu member. In this case, the
  172. //  LOWORD(lpici->lpVerb) contains the menuitem ID offset (menuitem ID -
  173. //  idCmdFirst).
  174. //
  175. //   This member function may also be called programmatically. In such a case,
  176. //  lpici->lpVerb specifies the canonical name of the command to be invoked,
  177. //  which is typically retrieved by GetCommandString member previously.
  178. //
  179. //  Parameters in lpci:
  180. //    cbSize -- Specifies the size of this structure (sizeof(*lpci))
  181. //    hwnd   -- Specifies the owner window for any message/dialog box.
  182. //    fMask  -- Specifies whether or not dwHotkey/hIcon paramter is valid.
  183. //    lpVerb -- Specifies the command to be invoked.
  184. //    lpParameters -- Parameters (optional)
  185. //    lpDirectory  -- Working directory (optional)
  186. //    nShow -- Specifies the flag to be passed to ShowWindow (SW_*).
  187. //    dwHotKey -- Hot key to be assigned to the app after invoked (optional).
  188. //    hIcon -- Specifies the icon (optional).
  189. //
  190. //
  191. // IContextMenu::GetCommandString
  192. //
  193. //   This member function is called by the explorer either to get the
  194. //  canonical (language independent) command name (uFlags == GCS_VERB) or
  195. //  the help text ((uFlags & GCS_HELPTEXT) != 0) for the specified command.
  196. //  The retrieved canonical string may be passed to its InvokeCommand
  197. //  member function to invoke a command programmatically. The explorer
  198. //  displays the help texts in its status bar; therefore, the length of
  199. //  the help text should be reasonably short (<40 characters).
  200. //
  201. //  Parameters:
  202. //   idCmd -- Specifies menuitem ID offset (from idCmdFirst)
  203. //   uFlags -- Either GCS_VERB or GCS_HELPTEXT
  204. //   pwReserved -- Reserved (must pass NULL when calling, must ignore when called)
  205. //   pszName -- Specifies the string buffer.
  206. //   cchMax -- Specifies the size of the string buffer.
  207. //
  208. //===========================================================================
  209.  
  210. typedef struct CMINVOKECOMMANDINFO {
  211.     DWORD cbSize;        // sizeof(CMINVOKECOMMANDINFO)
  212.     DWORD fMask;         // any combination of CMIC_MASK_*
  213.     HWND hwnd;           // might be NULL (indicating no owner window)
  214.     LONG /* LPCSTR */ lpVerb;       // either a string or MAKEINTRESOURCE(idOffset)
  215.     LONG /* LPCSTR */ lpParameters; // might be NULL (indicating no parameter)
  216.     LONG /* LPCSTR */ lpDirectory;  // might be NULL (indicating no specific directory)
  217.     ESW   nShow;           // one of SW_ values for ShowWindow() API
  218.     DWORD dwHotKey;
  219.     HICON hIcon;
  220. } CMINVOKECOMMANDINFO,  *LPCMINVOKECOMMANDINFO;
  221.  
  222. typedef struct CMINVOKECOMMANDINFOEX {
  223.     DWORD cbSize;        // must be sizeof(CMINVOKECOMMANDINFOEX)
  224.     DWORD fMask;         // any combination of CMIC_MASK_*
  225.     HWND hwnd;           // might be NULL (indicating no owner window)
  226.     LPCSTR lpVerb;       // either a string or MAKEINTRESOURCE(idOffset)
  227.     LPCSTR lpParameters; // might be NULL (indicating no parameter)
  228.     LPCSTR lpDirectory;  // might be NULL (indicating no specific directory)
  229.     ESW nShow;           // one of SW_ values for ShowWindow() API
  230.  
  231.     DWORD dwHotKey;
  232.     HICON hIcon;
  233.     LPCSTR lpTitle;      // For CreateProcess-StartupInfo.lpTitle
  234.     LPCWSTR lpVerbW;        // Unicode verb (for those who can use it)
  235.     LPCWSTR lpParametersW;  // Unicode parameters (for those who can use it)
  236.     LPCWSTR lpDirectoryW;   // Unicode directory (for those who can use it)
  237.     LPCWSTR lpTitleW;       // Unicode title (for those who can use it)
  238. } CMINVOKECOMMANDINFOEX,  *LPCMINVOKECOMMANDINFOEX;
  239.  
  240. [   uuid(000214E4-0000-0000-C000-000000000046),
  241.     odl,
  242.     helpstring("Visual Basic version of IContextMenu interface")
  243. ]
  244. interface IVBContextMenu : IUnknown {
  245.  
  246.     HRESULT QueryContextMenu(HMENU hmenu,
  247.                              long indexMenu,
  248.                              long idCmdFirst,
  249.                              long idCmdLast,
  250.                              long uFlags);
  251.  
  252.     HRESULT InvokeCommand(LPCMINVOKECOMMANDINFO lpici);
  253.  
  254.     HRESULT GetCommandString(long        idCmd,
  255.                              UINT        uType,
  256.                              UINT      * pwReserved,
  257.                              LPSTR       pszName,
  258.                              UINT        cchMax);
  259. };
  260. typedef IVBContextMenu *  LPCONTEXTMENU;
  261.  
  262. //
  263. // IContextMenu2 (IContextMenu with one new member)
  264. //
  265. // IContextMenu2::HandleMenuMsg
  266. //
  267. //  This function is called, if the client of IContextMenu is aware of
  268. // IContextMenu2 interface and receives one of following messages while
  269. // it is calling TrackPopupMenu (in the window proc of hwndOwner):
  270. //      WM_INITPOPUP, WM_DRAWITEM and WM_MEASUREITEM
  271. //  The callee may handle these messages to draw owner draw menuitems.
  272. //
  273.  
  274. [   uuid(000214F4-0000-0000-C000-000000000046),
  275.     odl,
  276.     helpstring("Visual Basic version of IContextMenu2 interface")
  277. ]
  278. interface IVBContextMenu2 : IUnknown {
  279.     HRESULT QueryContextMenu(HMENU hmenu,
  280.                              UINT indexMenu,
  281.                              UINT idCmdFirst,
  282.                              UINT idCmdLast,
  283.                              UINT uFlags);
  284.  
  285.     HRESULT InvokeCommand(LPCMINVOKECOMMANDINFO lpici);
  286.  
  287.     HRESULT GetCommandString(UINT        idCmd,
  288.                              UINT        uType,
  289.                              UINT      * pwReserved,
  290.                              LPSTR       pszName,
  291.                              UINT        cchMax);
  292.  
  293.     HRESULT HandleMenuMsg(UINT uMsg,
  294.                           WPARAM wParam,
  295.                           LPARAM lParam);
  296. };
  297. typedef IVBContextMenu2 * LPCONTEXTMENU2;
  298.  
  299. //===========================================================================
  300. //
  301. // Interface: IShellExtInit
  302. //
  303. //  The IShellExtInit interface is used by the explorer to initialize shell
  304. // extension objects. The explorer (1) calls CoCreateInstance (or equivalent)
  305. // with the registered CLSID and IID_IShellExtInit, (2) calls its Initialize
  306. // member, then (3) calls its QueryInterface to a particular interface (such
  307. // as IContextMenu or IPropSheetExt and (4) performs the rest of operation.
  308. //
  309. //
  310. // [Member functions]
  311. //
  312. // IShellExtInit::Initialize
  313. //
  314. //  This member function is called when the explorer is initializing either
  315. // context menu extension, property sheet extension or non-default drag-drop
  316. // extension.
  317. //
  318. //  Parameters: (context menu or property sheet extension)
  319. //   pidlFolder -- Specifies the parent folder
  320. //   lpdobj -- Spefifies the set of items selected in that folder.
  321. //   hkeyProgID -- Specifies the type of the focused item in the selection.
  322. //
  323. //  Parameters: (non-default drag-and-drop extension)
  324. //   pidlFolder -- Specifies the target (destination) folder
  325. //   lpdobj -- Specifies the items that are dropped (see the description
  326. //    about shell's clipboard below for clipboard formats).
  327. //   hkeyProgID -- Specifies the folder type.
  328. //
  329. //===========================================================================
  330.  
  331. /*
  332. [   uuid(000214E8-0000-0000-C000-000000000046),
  333.     odl,
  334.     helpstring("Visual Basic version of IShellExtInit interface")
  335. ]
  336. interface IVBShellExtInit : IUnknown {
  337.     // *** IShellExtInit methods ***
  338.     HRESULT Initialize(LPCITEMIDLIST pidlFolder,
  339.                        LPDATAOBJECT lpdobj, HKEY hkeyProgID);
  340. };
  341. typedef IVBShellExtInit * LPSHELLEXTINIT;
  342. */
  343.  
  344. //===========================================================================
  345. //
  346. // Interface: IShellPropSheetExt
  347. //
  348. //  The explorer uses the IShellPropSheetExt to allow property sheet
  349. // extensions or control panel extensions to add additional property
  350. // sheet pages.
  351. //
  352. //
  353. // [Member functions]
  354. //
  355. // IShellPropSheetExt::AddPages
  356. //
  357. //  The explorer calls this member function when it finds a registered
  358. // property sheet extension for a particular type of object. For each
  359. // additional page, the extension creates a page object by calling
  360. // CreatePropertySheetPage API and calls lpfnAddPage.
  361. //
  362. //  Parameters:
  363. //   lpfnAddPage -- Specifies the callback function.
  364. //   lParam -- Specifies the opaque handle to be passed to the callback function.
  365. //
  366. //
  367. // IShellPropSheetExt::ReplacePage
  368. //
  369. //  The explorer never calls this member of property sheet extensions. The
  370. // explorer calls this member of control panel extensions, so that they
  371. // can replace some of default control panel pages (such as a page of
  372. // mouse control panel).
  373. //
  374. //  Parameters:
  375. //   uPageID -- Specifies the page to be replaced.
  376. //   lpfnReplace Specifies the callback function.
  377. //   lParam -- Specifies the opaque handle to be passed to the callback function.
  378. //
  379. //===========================================================================
  380.  
  381. /*
  382. [   uuid(000214E9-0000-0000-C000-000000000046),
  383.     odl,
  384.     helpstring("Visual Basic version of IShellPropSheetExt interface")
  385. ]
  386. interface IVBShellPropSheetExt : IUnknown {
  387.     // *** IShellPropSheetExt methods ***
  388.     HRESULT AddPages(LPFNADDPROPSHEETPAGE lpfnAddPage, LPARAM lParam);
  389.     HRESULT ReplacePage(UINT uPageID, LPFNADDPROPSHEETPAGE lpfnReplaceWith, LPARAM lParam);
  390. };
  391. typedef IShellPropSheetExt * LPSHELLPROPSHEETEXT;
  392. */
  393.  
  394. //===========================================================================
  395. //
  396. // IPersistFolder Interface
  397. //
  398. //  The IPersistFolder interface is used by the file system implementation of
  399. // IShellFolder::BindToObject when it is initializing a shell folder object.
  400. //
  401. //
  402. // [Member functions]
  403. //
  404. // IPersistFolder::Initialize
  405. //
  406. //  This member function is called when the explorer is initializing a
  407. // shell folder object.
  408. //
  409. //  Parameters:
  410. //   pidl -- Specifies the absolute location of the folder.
  411. //
  412. //===========================================================================
  413.  
  414. /*
  415. [   uuid(000214EA-0000-0000-C000-000000000046),
  416.     odl,
  417.     helpstring("Visual Basic version of IPersistFolder interface")
  418. ]
  419. interface IVBPersistFolder : IPersist {
  420.     // *** IPersist methods ***
  421.     HRESULT GetClassID(LPCLSID lpClassID);
  422.  
  423.     // *** IPersistFolder methods ***
  424.     HRESULT Initialize(LPCITEMIDLIST pidl);
  425. };
  426. typedef IVBPersistFolder *LPPERSISTFOLDER;
  427. */
  428.  
  429. //===========================================================================
  430. //
  431. // IExtractIcon interface
  432. //
  433. //  This interface is used in two different places in the shell.
  434. //
  435. // Case-1: Icons of sub-folders for the scope-pane of the explorer.
  436. //
  437. //  It is used by the explorer to get the "icon location" of
  438. // sub-folders from each shell folders. When the user expands a folder
  439. // in the scope pane of the explorer, the explorer does following:
  440. //  (1) binds to the folder (gets IShellFolder),
  441. //  (2) enumerates its sub-folders by calling its EnumObjects member,
  442. //  (3) calls its GetUIObjectOf member to get IExtractIcon interface
  443. //     for each sub-folders.
  444. //  In this case, the explorer uses only IExtractIcon::GetIconLocation
  445. // member to get the location of the appropriate icon. An icon location
  446. // always consists of a file name (typically DLL or EXE) and either an icon
  447. // resource or an icon index.
  448. //
  449. //
  450. // Case-2: Extracting an icon image from a file
  451. //
  452. //  It is used by the shell when it extracts an icon image
  453. // from a file. When the shell is extracting an icon from a file,
  454. // it does following:
  455. //  (1) creates the icon extraction handler object (by getting its CLSID
  456. //     under the {ProgID}\shell\ExtractIconHanler key and calling
  457. //     CoCreateInstance requesting for IExtractIcon interface).
  458. //  (2) Calls IExtractIcon::GetIconLocation.
  459. //  (3) Then, calls IExtractIcon::ExtractIcon with the location/index pair.
  460. //  (4) If (3) returns NOERROR, it uses the returned icon.
  461. //  (5) Otherwise, it recursively calls this logic with new location
  462. //     assuming that the location string contains a fully qualified path name.
  463. //
  464. //  From extension programmer's point of view, there are only two cases
  465. // where they provide implementations of IExtractIcon:
  466. //  Case-1) providing explorer extensions (i.e., IShellFolder).
  467. //  Case-2) providing per-instance icons for some types of files.
  468. //
  469. // Because Case-1 is described above, we'll explain only Case-2 here.
  470. //
  471. // When the shell is about display an icon for a file, it does following:
  472. //  (1) Finds its ProgID and ClassID.
  473. //  (2) If the file has a ClassID, it gets the icon location string from the
  474. //    "DefaultIcon" key under it. The string indicates either per-class
  475. //    icon (e.g., "FOOBAR.DLL,2") or per-instance icon (e.g., "%1,1").
  476. //  (3) If a per-instance icon is specified, the shell creates an icon
  477. //    extraction handler object for it, and extracts the icon from it
  478. //    (which is described above).
  479. //
  480. //  It is important to note that the shell calls IExtractIcon::GetIconLocation
  481. // first, then calls IExtractIcon::Extract. Most application programs
  482. // that support per-instance icons will probably store an icon location
  483. // (DLL/EXE name and index/id) rather than an icon image in each file.
  484. // In those cases, a programmer needs to implement only the GetIconLocation
  485. // member and it Extract member simply returns S_FALSE. They need to
  486. // implement Extract member only if they decided to store the icon images
  487. // within files themselved or some other database (which is very rare).
  488. //
  489. //
  490. //
  491. // [Member functions]
  492. //
  493. //
  494. // IExtractIcon::GetIconLocation
  495. //
  496. //  This function returns an icon location.
  497. //
  498. //  Parameters:
  499. //   uFlags     [in]  -- Specifies if it is opened or not (GIL_OPENICON or 0)
  500. //   szIconFile [out] -- Specifies the string buffer buffer for a location name.
  501. //   cchMax     [in]  -- Specifies the size of szIconFile (almost always MAX_PATH)
  502. //   piIndex    [out] -- Sepcifies the address of UINT for the index.
  503. //   pwFlags    [out] -- Returns GIL_* flags
  504. //  Returns:
  505. //   NOERROR, if it returns a valid location; S_FALSE, if the shell use a
  506. //   default icon.
  507. //
  508. //  Notes: The location may or may not be a path to a file. The caller can
  509. //   not assume anything unless the subsequent Extract member call returns
  510. //   S_FALSE.
  511. //
  512. //   if the returned location is not a path to a file, GIL_NOTFILENAME should
  513. //   be set in the returned flags.
  514. //
  515. // IExtractIcon::Extract
  516. //
  517. //  This function extracts an icon image from a specified file.
  518. //
  519. //  Parameters:
  520. //   pszFile [in] -- Specifies the icon location (typically a path to a file).
  521. //   nIconIndex [in] -- Specifies the icon index.
  522. //   phiconLarge [out] -- Specifies the HICON variable for large icon.
  523. //   phiconSmall [out] -- Specifies the HICON variable for small icon.
  524. //   nIconSize [in] -- Specifies the size icon required (size of large icon)
  525. //                     LOWORD is the requested large icon size
  526. //                     HIWORD is the requested small icon size
  527. //  Returns:
  528. //   NOERROR, if it extracted the from the file.
  529. //   S_FALSE, if the caller should extract from the file specified in the
  530. //           location.
  531. //
  532. //===========================================================================
  533.  
  534. [
  535.     odl,
  536.     helpstring("Visual Basic version of IExtractIcon interface"),
  537. #ifdef UNICODE
  538.     uuid(000214FA-0000-0000-C000-000000000046),
  539. #else
  540.     uuid(000214EB-0000-0000-C000-000000000046),
  541. #endif
  542. ]
  543. interface IVBExtractIcon : IUnknown {
  544.     // *** IExtractIcon methods ***
  545.     HRESULT GetIconLocation(UINT   uFlags,
  546.                             LPTSTR  szIconFile,
  547.                             UINT   cchMax,
  548.                             int   * piIndex,
  549.                             UINT  * pwFlags);
  550.  
  551.     HRESULT Extract(LPCTSTR pszFile,
  552.                     UINT   nIconIndex,
  553.                     HICON   *phiconLarge,
  554.                     HICON   *phiconSmall,
  555.                     UINT    nIconSize);
  556. };
  557. typedef IVBExtractIcon * LPEXTRACTICON;
  558.  
  559. //===========================================================================
  560. //
  561. // IShellIcon Interface
  562. //
  563. // used to get a icon index for a IShellFolder object.
  564. //
  565. // this interface can be implemented by a IShellFolder, as a quick way to
  566. // return the icon for a object in the folder.
  567. //
  568. // a instance of this interface is only created once for the folder, unlike
  569. // IExtractIcon witch is created once for each object.
  570. //
  571. // if a ShellFolder does not implement this interface, the standard
  572. // GetUIObject(....IExtractIcon) method will be used to get a icon
  573. // for all objects.
  574. //
  575. // the following standard imagelist indexs can be returned:
  576. //
  577. //      0   document (blank page) (not associated)
  578. //      1   document (with stuff on the page)
  579. //      2   application (exe, com, bat)
  580. //      3   folder (plain)
  581. //      4   folder (open)
  582. //
  583. // IShellIcon:GetIconOf(pidl, flags, lpIconIndex)
  584. //
  585. //      pidl            object to get icon for.
  586. //      flags           GIL_* input flags (GIL_OPEN, ...)
  587. //      lpIconIndex     place to return icon index.
  588. //
  589. //  returns:
  590. //      NOERROR, if lpIconIndex contains the correct system imagelist index.
  591. //      S_FALSE, if unable to get icon for this object, go through
  592. //               GetUIObject, IExtractIcon, methods.
  593. //
  594. //===========================================================================
  595.  
  596. [   uuid(000214E5-0000-0000-C000-000000000046),
  597.     odl,
  598.     helpstring("Visual Basic version of IShellIcon interface")
  599. ]
  600. interface IVBShellIcon : IUnknown {
  601.     // *** IShellIcon methods ***
  602.     HRESULT GetIconOf(LPCITEMIDLIST pidl,
  603.                       UINT flags,
  604.                       INT * lpIconIndex);
  605. };
  606. typedef IVBShellIcon *LPSHELLICON;
  607.  
  608. //===========================================================================
  609. //
  610. // IShellLink Interface
  611. //
  612. //===========================================================================
  613.  
  614. // IShellLink::Resolve fFlags
  615. typedef enum ESLR {
  616.     SLR_NO_UI           = 0x0001,
  617.     SLR_ANY_MATCH       = 0x0002,
  618.     SLR_UPDATE          = 0x0004,
  619. } ESLR;
  620.  
  621. // IShellLink::GetPath fFlags
  622. typedef enum ESLGP {
  623.     SLGP_SHORTPATH      = 0x0001,
  624.     SLGP_UNCPRIORITY    = 0x0002,
  625. } ESLGP;
  626.  
  627. [   odl,
  628.     helpstring("Visual Basic version of IShellLink interface"),
  629. #ifdef UNICODE
  630.     uuid(000214F9-0000-0000-C000-000000000046)
  631. #else
  632.     uuid(000214EE-0000-0000-C000-000000000046)
  633. #endif
  634. ]
  635. interface IVBShellLink : IUnknown {
  636.  
  637.     [ helpstring("Retrieves the path and filename of a shell link object") ]
  638.     HRESULT GetPath([in, out] LPTSTR pszFile,
  639.                     [in] int cchMaxPath,
  640.                     [in, out] LPVOID pfd,
  641.                     [in] ESLGP fFlags);
  642.  
  643.     [ helpstring("Retrieves the list of shell link item identifiers") ]
  644.     HRESULT GetIDList([out, retval] LPITEMIDLIST * ppidl);
  645.     [ helpstring("Sets the list of shell link item identifiers") ]
  646.     HRESULT SetIDList([in] LPCITEMIDLIST pidl);
  647.  
  648.     [ helpstring("Retrieves the shell link description string") ]
  649.     HRESULT GetDescription([in, out] LPTSTR pszName,
  650.                            [in] int cchMaxName);
  651.     [ helpstring("Sets the shell link description string") ]
  652.     HRESULT SetDescription([in] LPCTSTR pszName);
  653.  
  654.     [ helpstring("Retrieves the name of the shell link working directory") ]
  655.     HRESULT GetWorkingDirectory([in, out] LPTSTR pszDir,
  656.                                 [in] int cchMaxPath);
  657.     [ helpstring("Sets the name of the shell link working directory") ]
  658.     HRESULT SetWorkingDirectory([in] LPCTSTR pszDir);
  659.  
  660.     [ helpstring("Retrieves the shell link command-line arguments") ]
  661.     HRESULT GetArguments(LPTSTR pszArgs, int cchMaxPath);
  662.     [ helpstring("Sets the shell link command-line arguments") ]
  663.     HRESULT SetArguments([in] LPCTSTR pszArgs);
  664.  
  665.     [ propget, helpstring("Retrieves or sets the shell link hot key") ]
  666.     HRESULT Hotkey([out, retval] WORD *pwHotkey);
  667.     [ propput ]
  668.     HRESULT Hotkey([in] WORD wHotkey);
  669.  
  670.     [ propget,
  671.       helpstring("Retrieves or sets the shell link show command") ]
  672.     HRESULT ShowCmd([out, retval] ESW *piShowCmd);
  673.     [ propput ]
  674.     HRESULT ShowCmd([in] ESW iShowCmd);
  675.  
  676.     [ helpstring("Retrieves the location (path and index) of the shell link icon") ]
  677.     HRESULT GetIconLocation([in, out] LPTSTR pszIconPath,
  678.                             [in] int cchIconPath,
  679.                             [in, out] int *piIcon);
  680.     [ helpstring("Sets the location (path and index) of the shell link icon") ]
  681.     HRESULT SetIconLocation([in] LPCTSTR pszIconPath,
  682.                             [in] int iIcon);
  683.  
  684.     [ helpstring("Sets the shell link relative path") ]
  685.     HRESULT SetRelativePath([in] LPCTSTR pszPathRel,
  686.                             [in] DWORD dwReserved);
  687.  
  688.     [ helpstring("Resolves a shell link. The system searches for the shell link object and updates the shell link path and its list of identifiers (if necessary)") ]
  689.     HRESULT Resolve([in] HWND hwnd,
  690.                     [in] ESLR fFlags);
  691.  
  692.     [ helpstring("Sets the shell link path and filename") ]
  693.     HRESULT SetPath([in] LPCTSTR pszFile);
  694. };
  695.  
  696. [   uuid(00021401-0000-0000-C000-000000000046),
  697.     helpstring("Visual Basic CShellLink class")
  698. ]
  699. coclass CShellLink {
  700.     [default]
  701.     interface IVBShellLink;
  702. };
  703.  
  704. //===========================================================================
  705. //
  706. // IShellExecuteHook Interface
  707. //
  708. //===========================================================================
  709.  
  710. /*
  711. [   odl,
  712.     helpstring("Visual Basic version of IShellExecuteHook interface"),
  713. #ifdef UNICODE
  714.     uuid(000214FB-0000-0000-C000-000000000046)
  715. #else
  716.     uuid(000214EF-0000-0000-C000-000000000046)
  717. #endif
  718. ]
  719. interface IVBShellExecuteHook : IUnknown {
  720.     // *** IShellExecuteHook methods ***
  721.     HRESULT Execute(LPSHELLEXECUTEINFO pei);
  722. };
  723. */
  724.  
  725. //===========================================================================
  726. //
  727. // INewShortcutHook Interface
  728. //
  729. //===========================================================================
  730.  
  731. [   odl,
  732.     helpstring("Visual Basic version of INewShortcutHookA interface"),
  733. #ifdef UNICODE
  734.     uuid(000214F7-0000-0000-C000-000000000046)
  735. ]
  736. interface INewShortcutHookA : IUnknown {
  737. #else
  738.     uuid(000214E1-0000-0000-C000-000000000046)
  739. ]
  740. interface INewShortcutHookA : IUnknown {
  741. #endif
  742.     // *** INewShortcutHook methods ***
  743.     HRESULT SetReferent(LPCTSTR pcszReferent, HWND hwnd);
  744.     HRESULT GetReferent(LPTSTR pszReferent, int cchReferent);
  745.     HRESULT SetFolder(LPCTSTR pcszFolder);
  746.     HRESULT GetFolder(LPTSTR pszFolder, int cchFolder);
  747.     HRESULT GetName(LPTSTR pszName, int cchName);
  748.     HRESULT GetExtension(LPTSTR pszExtension, int cchExtension);
  749. };
  750.  
  751. //===========================================================================
  752. //
  753. // ICopyHook Interface
  754. //
  755. //  The copy hook is called whenever file system directories are
  756. //  copy/moved/deleted/renamed via the shell.  It is also called by the shell
  757. //  on changes of status of printers.
  758. //
  759. //  Clients register their id under STRREG_SHEX_COPYHOOK for file system hooks
  760. //  and STRREG_SHEx_PRNCOPYHOOK for printer hooks.
  761. //  the CopyCallback is called prior to the action, so the hook has the chance
  762. //  to allow, deny or cancel the operation by returning the falues:
  763. //     IDYES  -  means allow the operation
  764. //     IDNO   -  means disallow the operation on this file, but continue with
  765. //              any other operations (eg. batch copy)
  766. //     IDCANCEL - means disallow the current operation and cancel any pending
  767. //              operations
  768. //
  769. //   arguments to the CopyCallback
  770. //      hwnd - window to use for any UI
  771. //      wFunc - what operation is being done
  772. //      wFlags - and flags (FOF_*) set in the initial call to the file operation
  773. //      pszSrcFile - name of the source file
  774. //      dwSrcAttribs - file attributes of the source file
  775. //      pszDestFile - name of the destiation file (for move and renames)
  776. //      dwDestAttribs - file attributes of the destination file
  777. //
  778. //
  779. //===========================================================================
  780.  
  781. /*
  782. [   odl,
  783.     helpstring("Visual Basic version of ICopyHook interface"),
  784. #ifdef UNICODE
  785.     uuid(-0000-0000-C000-000000000046), uuid(-0000-0000-C000-000000000046)
  786. #else
  787.     uuid(-0000-0000-C000-000000000046), uuid(-0000-0000-C000-000000000046)
  788. #endif
  789. ]
  790. interface IVBCopyHook : IUnknown {
  791.     UINT CopyCallback(HWND hwnd, UINT wFunc, UINT wFlags,
  792.                       LPCTSTR pszSrcFile, DWORD dwSrcAttribs,
  793.                       LPCTSTR pszDestFile, DWORD dwDestAttribs);
  794. };
  795. typedef IVBCopyHook *    LPCOPYHOOK;
  796. #endif
  797. */
  798.  
  799. //===========================================================================
  800. //
  801. // IFileViewerSite Interface
  802. //
  803. //===========================================================================
  804.  
  805. [   uuid(000214F3-0000-0000-C000-000000000046),
  806.     odl,
  807.     helpstring("Visual Basic version of IFileViewerSite interface")
  808. ]
  809. interface IVBFileViewerSite {
  810.     HRESULT SetPinnedWindow(HWND hwnd);
  811.     HRESULT GetPinnedWindow(HWND *phwnd);
  812. };
  813. typedef IVBFileViewerSite * LPFILEVIEWERSITE;
  814.  
  815. //===========================================================================
  816. //
  817. // IFileViewer Interface
  818. //
  819. // Implemented in a FileViewer component object.  Used to tell a
  820. // FileViewer to PrintTo or to view, the latter happening though
  821. // ShowInitialize and Show.  The filename is always given to the
  822. // viewer through IPersistFile.
  823. //
  824. //===========================================================================
  825.  
  826. typedef struct FVSHOWINFO
  827. {
  828.     // Stuff passed into viewer (in)
  829.     DWORD cbSize;           // Size of structure for future expansion...
  830.     HWND hwndOwner;         // who is the owner window.
  831.     ESW iShow;              // The show command
  832.  
  833.     // Passed in and updated  (in/Out)
  834.     DWORD dwFlags;          // flags
  835.     RECT rect;              // Where to create the window may have defaults
  836.     LPUNKNOWN punkRel;      // Relese this interface when window is visible
  837.  
  838.     // Stuff that might be returned from viewer (out)
  839.     OLECHAR strNewFile[260 /*MAX_PATH*/];   // New File to view.
  840.  
  841. } FVSHOWINFO, *LPFVSHOWINFO;
  842.  
  843. [   odl,
  844.     helpstring("Visual Basic version of IFileViewer interface"),
  845. #ifdef UNICODE
  846.     uuid(000214F8-0000-0000-C000-000000000046)
  847. #else
  848.     uuid(000214F0-0000-0000-C000-000000000046)
  849. #endif
  850. ]
  851. interface IVBFileViewer {
  852.     HRESULT ShowInitialize(LPFILEVIEWERSITE lpfsi);
  853.     HRESULT Show(LPFVSHOWINFO pvsi);
  854.     HRESULT PrintTo(LPSTR pszDriver, BOOL fSuppressUI);
  855. };
  856. typedef IVBFileViewer * LPFILEVIEWER;
  857.  
  858. // CommandTarget ids. for shell doc view wedge
  859. enum {
  860.     SHDVID_SETPROGRESSPOS,
  861.     SHDVID_SETPROGRESSRANGE,
  862.     SHDVID_SETSTATUSTEXT,    // variantIn  bstr
  863.  
  864.     SHDVID_REFRESH,
  865.     SHDVID_STOP,
  866.     SHDVID_UPDATECOMMANDS, /// this forces a re-querystatus of the command targets.
  867.                            /// the arg in can specify a specific one to update or NULL for evrything
  868.     SHDVID_SETTITLE,            // variantIn bstr
  869.     SHDVID_FINALTITLEAVAIL,     // variantIn bstr - sent after final SETTITLE is sent
  870.     SHDVID_STARTLOAD,           // NULL for everything
  871.     SHDVID_STOPLOAD             // NULL for everything
  872. #if MSOCT2
  873.     ,SHDVID_CCALLBACK,          // callback to arbitrary C func
  874.     SHDVID_MENUEXEC,            // do menu command
  875.     SHDVID_MENUQS               // query menu commands
  876. #endif
  877. };
  878.  
  879.  
  880.  
  881. //==========================================================================
  882. //
  883. // IShellBrowser/IShellView/IShellFolder interface
  884. //
  885. //  These three interfaces are used when the shell communicates with
  886. // name space extensions. The shell (explorer) provides IShellBrowser
  887. // interface, and extensions implements IShellFolder and IShellView
  888. // interfaces.
  889. //
  890. //==========================================================================
  891.  
  892.  
  893.  
  894. //--------------------------------------------------------------------------
  895. //
  896. // FOLDERSETTINGS
  897. //
  898. //  FOLDERSETTINGS is a data structure that explorer passes from one folder
  899. // view to another, when the user is browsing. It calls ISV::GetCurrentInfo
  900. // member to get the current settings and pass it to ISV::CreateViewWindow
  901. // to allow the next folder view "inherit" it. These settings assumes a
  902. // particular UI (which the shell's folder view has), and shell extensions
  903. // may or may not use those settings.
  904. //
  905. //--------------------------------------------------------------------------
  906.  
  907. typedef BYTE * LPVIEWSETTINGS;
  908.  
  909. // NB Bitfields.
  910. // FWF_DESKTOP implies FWF_TRANSPARENT/NOCLIENTEDGE/NOSCROLL
  911. typedef enum
  912.     {
  913.     FWF_AUTOARRANGE =       0x0001,
  914.     FWF_ABBREVIATEDNAMES =  0x0002,
  915.     FWF_SNAPTOGRID =        0x0004,
  916.     FWF_OWNERDATA =         0x0008,
  917.     FWF_BESTFITWINDOW =     0x0010,
  918.     FWF_DESKTOP =           0x0020,
  919.     FWF_SINGLESEL =         0x0040,
  920.     FWF_NOSUBFOLDERS =      0x0080,
  921.     FWF_TRANSPARENT  =      0x0100,
  922.     FWF_NOCLIENTEDGE =      0x0200,
  923.     FWF_NOSCROLL     =      0x0400,
  924.     FWF_ALIGNLEFT    =      0x0800,
  925.     FWF_SINGLECLICKACTIVATE=0x8000  // TEMPORARY -- NO UI FOR THIS
  926.     } FOLDERFLAGS;
  927.  
  928. typedef enum
  929.     {
  930.     FVM_ICON =              1,
  931.     FVM_SMALLICON =         2,
  932.     FVM_LIST =              3,
  933.     FVM_DETAILS =           4,
  934.     } FOLDERVIEWMODE;
  935.  
  936. typedef struct
  937.     {
  938.     UINT ViewMode;       // View mode (FOLDERVIEWMODE values)
  939.     UINT fFlags;         // View options (FOLDERFLAGS bits)
  940.     } FOLDERSETTINGS, *LPFOLDERSETTINGS;
  941.  
  942. typedef const FOLDERSETTINGS * LPCFOLDERSETTINGS;
  943.  
  944.  
  945. //--------------------------------------------------------------------------
  946. //
  947. // Interface:   IShellBrowser
  948. //
  949. //  IShellBrowser interface is the interface that is provided by the shell
  950. // explorer/folder frame window. When it creates the "contents pane" of
  951. // a shell folder (which provides IShellFolder interface), it calls its
  952. // CreateViewObject member function to create an IShellView object. Then,
  953. // it calls its CreateViewWindow member to create the "contents pane"
  954. // window. The pointer to the IShellBrowser interface is passed to
  955. // the IShellView object as a parameter to this CreateViewWindow member
  956. // function call.
  957. //
  958. //    +--------------------------+  <-- Explorer window
  959. //    | [] Explorer              |
  960. //    |--------------------------+       IShellBrowser
  961. //    | File Edit View ..        |
  962. //    |--------------------------|
  963. //    |        |                 |
  964. //    |        |              <-------- Content pane
  965. //    |        |                 |
  966. //    |        |                 |       IShellView
  967. //    |        |                 |
  968. //    |        |                 |
  969. //    +--------------------------+
  970. //
  971. //
  972. //
  973. // [Member functions]
  974. //
  975. //
  976. // IShellBrowser::GetWindow(phwnd)
  977. //
  978. //   Inherited from IOleWindow::GetWindow.
  979. //
  980. //
  981. // IShellBrowser::ContextSensitiveHelp(fEnterMode)
  982. //
  983. //   Inherited from IOleWindow::ContextSensitiveHelp.
  984. //
  985. //
  986. // IShellBrowser::InsertMenusSB(hmenuShared, lpMenuWidths)
  987. //
  988. //   Similar to the IOleInPlaceFrame::InsertMenus. The explorer will put
  989. //  "File" and "Edit" pulldown in the File menu group, "View" and "Tools"
  990. //  in the Container menu group and "Help" in the Window menu group. Each
  991. //  pulldown menu will have a uniqu ID, FCIDM_MENU_FILE/EDIT/VIEW/TOOLS/HELP.
  992. //  The view is allowed to insert menuitems into those sub-menus by those
  993. //  IDs must be between FCIDM_SHVIEWFIRST and FCIDM_SHVIEWLAST.
  994. //
  995. //
  996. // IShellBrowser::SetMenuSB(hmenuShared, holemenu, hwndActiveObject)
  997. //
  998. //   Similar to the IOleInPlaceFrame::SetMenu. The explorer ignores the
  999. //  holemenu parameter (reserved for future enhancement)  and performs
  1000. //  menu-dispatch based on the menuitem IDs (see the description above).
  1001. //  It is important to note that the explorer will add different
  1002. //  set of menuitems depending on whether the view has a focus or not.
  1003. //  Therefore, it is very important to call ISB::OnViewWindowActivate
  1004. //  whenever the view window (or its children) gets the focus.
  1005. //
  1006. //
  1007. // IShellBrowser::RemoveMenusSB(hmenuShared)
  1008. //
  1009. //   Same as the IOleInPlaceFrame::RemoveMenus.
  1010. //
  1011. //
  1012. // IShellBrowser::SetStatusTextSB(lpszStatusText)
  1013. //
  1014. //   Same as the IOleInPlaceFrame::SetStatusText. It is also possible to
  1015. //  send messages directly to the status window via SendControlMsg.
  1016. //
  1017. //
  1018. // IShellBrowser::EnableModelessSB(fEnable)
  1019. //
  1020. //   Same as the IOleInPlaceFrame::EnableModeless.
  1021. //
  1022. //
  1023. // IShellBrowser::TranslateAcceleratorSB(lpmsg, wID)
  1024. //
  1025. //   Same as the IOleInPlaceFrame::TranslateAccelerator, but will be
  1026. //  never called because we don't support EXEs (i.e., the explorer has
  1027. //  the message loop). This member function is defined here for possible
  1028. //  future enhancement.
  1029. //
  1030. //
  1031. // IShellBrowser::BrowseObject(pidl, wFlags)
  1032. //
  1033. //   The view calls this member to let shell explorer browse to another
  1034. //  folder. The pidl and wFlags specifies the folder to be browsed.
  1035. //
  1036. //  Following three flags specifies whether it creates another window or not.
  1037. //   SBSP_SAMEBROWSER  -- Browse to another folder with the same window.
  1038. //   SBSP_NEWBROWSER   -- Creates another window for the specified folder.
  1039. //   SBSP_DEFBROWSER   -- Default behavior (respects the view option).
  1040. //
  1041. //  Following three flags specifies open, explore, or default mode. These   .
  1042. //  are ignored if SBSP_SAMEBROWSER or (SBSP_DEFBROWSER && (single window   .
  1043. //  browser || explorer)).                                                  .
  1044. //   SBSP_OPENMODE     -- Use a normal folder window
  1045. //   SBSP_EXPLOREMODE  -- Use an explorer window
  1046. //   SBSP_DEFMODE      -- Use the same as the current window
  1047. //
  1048. //  Following three flags specifies the pidl.
  1049. //   SBSP_ABSOLUTE -- pidl is an absolute pidl (relative from desktop)
  1050. //   SBSP_RELATIVE -- pidl is relative from the current folder.
  1051. //   SBSP_PARENT   -- Browse the parent folder (ignores the pidl)
  1052. //
  1053. //
  1054. // IShellBrowser::GetViewStateStream(grfMode, ppstm)
  1055. //
  1056. //   The browser returns an IStream interface as the storage for view
  1057. //  specific state information.
  1058. //
  1059. //   grfMode -- Specifies the read/write access (STGM_READ/WRITE/READWRITE)
  1060. //   ppstm   -- Specifies the LPSTREAM variable to be filled.
  1061. //
  1062. //
  1063. // IShellBrowser::GetControlWindow(id, phwnd)
  1064. //
  1065. //   The shell view may call this member function to get the window handle
  1066. //  of Explorer controls (toolbar or status winodw -- FCW_TOOLBAR or
  1067. //  FCW_STATUS).
  1068. //
  1069. //
  1070. // IShellBrowser::SendControlMsg(id, uMsg, wParam, lParam, pret)
  1071. //
  1072. //   The shell view calls this member function to send control messages to
  1073. //  one of Explorer controls (toolbar or status window -- FCW_TOOLBAR or
  1074. //  FCW_STATUS).
  1075. //
  1076. //
  1077. // IShellBrowser::QueryActiveShellView(IShellView * ppshv)
  1078. //
  1079. //   This member returns currently activated (displayed) shellview object.
  1080. //  A shellview never need to call this member function.
  1081. //
  1082. //
  1083. // IShellBrowser::OnViewWindowActive(pshv)
  1084. //
  1085. //   The shell view window calls this member function when the view window
  1086. //  (or one of its children) got the focus. It MUST call this member before
  1087. //  calling IShellBrowser::InsertMenus, because it will insert different
  1088. //  set of menu items depending on whether the view has the focus or not.
  1089. //
  1090. //
  1091. // IShellBrowser::SetToolbarItems(lpButtons, nButtons, uFlags)
  1092. //
  1093. //   The view calls this function to add toolbar items to the exporer's
  1094. //  toolbar. "lpButtons" and "nButtons" specifies the array of toolbar
  1095. //  items. "uFlags" must be one of FCT_MERGE, FCT_CONFIGABLE, FCT_ADDTOEND.
  1096. //
  1097. //-------------------------------------------------------------------------
  1098.  
  1099. /*
  1100. [   odl,
  1101.     helpstring("Visual Basic version of IShellBrowser interface"),
  1102.     uuid(000214E2-0000-0000-C000-000000000046)
  1103. ]
  1104. interface IVBShellBrowser : IOleWindow {
  1105.     // *** IShellBrowser methods *** (same as IOleInPlaceFrame)
  1106.     HRESULT InsertMenusSB(HMENU hmenuShared,
  1107.                           LPOLEMENUGROUPWIDTHS lpMenuWidths);
  1108.     HRESULT SetMenuSB(HMENU hmenuShared, HOLEMENU holemenuReserved,
  1109.                 HWND hwndActiveObject);
  1110.     HRESULT RemoveMenusSB(HMENU hmenuShared);
  1111.     HRESULT SetStatusTextSB(LPCOLESTR lpszStatusText);
  1112.     HRESULT EnableModelessSB(BOOL fEnable);
  1113.     HRESULT TranslateAcceleratorSB(LPMSG lpmsg, WORD wID);
  1114.  
  1115.     // *** IShellBrowser methods ***
  1116.     HRESULT BrowseObject(LPCITEMIDLIST pidl, UINT wFlags);
  1117.     HRESULT GetViewStateStream(DWORD grfMode,
  1118.                 LPSTREAM  *ppStrm);
  1119.     HRESULT GetControlWindow(UINT id, HWND * lphwnd);
  1120.     HRESULT SendControlMsg(UINT id, UINT uMsg, WPARAM wParam,
  1121.                 LPARAM lParam, LRESULT * pret);
  1122.     HRESULT QueryActiveShellView(struct IShellView ** ppshv);
  1123.     HRESULT OnViewWindowActive(struct IShellView * ppshv);
  1124.     HRESULT SetToolbarItems(LPTBBUTTON lpButtons, UINT nButtons,
  1125.                 UINT uFlags);
  1126. };
  1127. typedef IVBShellBrowser * LPSHELLBROWSER;
  1128. */
  1129. enum {
  1130.         SBSC_HIDE = 0,
  1131.         SBSC_SHOW = 1,
  1132.         SBSC_TOGGLE = 2,
  1133.         SBSC_QUERY =  3
  1134. };
  1135.  
  1136. // CommandTarget ids.
  1137. enum {
  1138.         SBCMDID_ENABLESHOWTREE,
  1139.         SBCMDID_SHOWCONTROL,            // variant vt_i4 = loword = FCW_* hiword = SBSC_*
  1140.         SBCMDID_CANCELNAVIGATION,       // cancel last navigation
  1141.         SBCMDID_MAYSAVECHANGES,         // about to close and may save changes
  1142.         SBCMDID_SETHLINKFRAME,          // variant vt_i4 = phlinkframe
  1143.         SBCMDID_ENABLESTOP,             // variant vt_bool = fEnable
  1144.         SBCMDID_OPTIONS,                // the view.options page
  1145. };
  1146.  
  1147.  
  1148. //-------------------------------------------------------------------------
  1149. // ICommDlgBrowser interface
  1150. //
  1151. //  ICommDlgBrowser interface is the interface that is provided by the new
  1152. // common dialog window to hook and modify the behavior of IShellView.  When
  1153. // a default view is created, it queries its parent IShellBrowser for the
  1154. // ICommDlgBrowser interface.  If supported, it calls out to that interface
  1155. // in several cases that need to behave differently in a dialog.
  1156. //
  1157. // Member functions:
  1158. //
  1159. //  ICommDlgBrowser::OnDefaultCommand()
  1160. //    Called when the user double-clicks in the view or presses Enter.  The
  1161. //   browser should return S_OK if it processed the action itself, S_FALSE
  1162. //   to let the view perform the default action.
  1163. //
  1164. //  ICommDlgBrowser::OnStateChange(ULONG uChange)
  1165. //    Called when some states in the view change.  'uChange' is one of the
  1166. //   CDBOSC_* values.  This call is made after the state (selection, focus,
  1167. //   etc) has changed.  There is no return value.
  1168. //
  1169. //  ICommDlgBrowser::IncludeObject(LPCITEMIDLIST pidl)
  1170. //    Called when the view is enumerating objects.  'pidl' is a relative
  1171. //   IDLIST.  The browser should return S_OK to include the object in the
  1172. //   view, S_FALSE to hide it
  1173. //
  1174. //-------------------------------------------------------------------------
  1175.  
  1176. /*
  1177. [   odl,
  1178.     helpstring("Visual Basic version of ICommDlgBrowser interface"),
  1179.     uuid(000214F1-0000-0000-C000-000000000046)
  1180. ]
  1181. interface ICommDlgBrowser : IUnknown {
  1182.     // *** ICommDlgBrowser methods ***
  1183.     HRESULT OnDefaultCommand(struct IVBShellView * ppshv);
  1184.     HRESULT OnStateChange(struct IShellView * ppshv,
  1185.                           ULONG uChange);
  1186.     HRESULT IncludeObject(struct IVBShellView * ppshv,
  1187.                           LPCITEMIDLIST pidl);
  1188. };
  1189. typedef IVBCommDlgBrowser * LPCOMMDLGBROWSER;
  1190. */
  1191.  
  1192.  
  1193. //==========================================================================
  1194. //
  1195. // Interface:   IShellView
  1196. //
  1197. // IShellView::GetWindow(phwnd)
  1198. //
  1199. //   Inherited from IOleWindow::GetWindow.
  1200. //
  1201. //
  1202. // IShellView::ContextSensitiveHelp(fEnterMode)
  1203. //
  1204. //   Inherited from IOleWindow::ContextSensitiveHelp.
  1205. //
  1206. //
  1207. // IShellView::TranslateAccelerator(lpmsg)
  1208. //
  1209. //   Similar to IOleInPlaceActiveObject::TranlateAccelerator. The explorer
  1210. //  calls this function BEFORE any other translation. Returning S_OK
  1211. //  indicates that the message was translated (eaten) and should not be
  1212. //  translated or dispatched by the explorer.
  1213. //
  1214. //
  1215. // IShellView::EnableModeless(fEnable)
  1216. //   Similar to IOleInPlaceActiveObject::EnableModeless.
  1217. //
  1218. //
  1219. // IShellView::UIActivate(uState)
  1220. //
  1221. //   The explorer calls this member function whenever the activation
  1222. //  state of the view window is changed by a certain event that is
  1223. //  NOT caused by the shell view itself.
  1224. //
  1225. //   SVUIA_DEACTIVATE will be passed when the explorer is about to
  1226. //  destroy the shell view window; the shell view is supposed to remove
  1227. //  all the extended UIs (typically merged menu and modeless popup windows).
  1228. //
  1229. //   SVUIA_ACTIVATE_NOFOCUS will be passsed when the shell view is losing
  1230. //  the input focus or the shell view has been just created without the
  1231. //  input focus; the shell view is supposed to set menuitems appropriate
  1232. //  for non-focused state (no selection specific items should be added).
  1233. //
  1234. //   SVUIA_ACTIVATE_FOCUS will be passed when the explorer has just
  1235. //  created the view window with the input focus; the shell view is
  1236. //  supposed to set menuitems appropriate for focused state.
  1237. //
  1238. //   SVUIA_INPLACEACTIVATE(new) will be passed when the shell view is opened
  1239. //  within an ActiveX control, which is not a UI active. In this case,
  1240. //  the shell view should not merge menus or put toolbas. To be compatible
  1241. //  with Win95 client, we don't pass this value unless the view supports
  1242. //  IShellView2.
  1243. //
  1244. //   The shell view should not change focus within this member function.
  1245. //  The shell view should not hook the WM_KILLFOCUS message to remerge
  1246. //  menuitems. However, the shell view typically hook the WM_SETFOCUS
  1247. //  message, and re-merge the menu after calling IShellBrowser::
  1248. //  OnViewWindowActivated.
  1249. //
  1250. //
  1251. // IShellView::Refresh()
  1252. //
  1253. //   The explorer calls this member when the view needs to refresh its
  1254. //  contents (such as when the user hits F5 key).
  1255. //
  1256. //
  1257. // IShellView::CreateViewWindow
  1258. //
  1259. //   This member creates the view window (right-pane of the explorer or the
  1260. //  client window of the folder window).
  1261. //
  1262. //
  1263. // IShellView::DestroyViewWindow
  1264. //
  1265. //   This member destroys the view window.
  1266. //
  1267. //
  1268. // IShellView::GetCurrentInfo
  1269. //
  1270. //   This member returns the folder settings.
  1271. //
  1272. //
  1273. // IShellView::AddPropertySHeetPages
  1274. //
  1275. //   The explorer calls this member when it is opening the option property
  1276. //  sheet. This allows the view to add additional pages to it.
  1277. //
  1278. //
  1279. // IShellView::SaveViewState()
  1280. //
  1281. //   The explorer calls this member when the shell view is supposed to
  1282. //  store its view settings. The shell view is supposed to get a view
  1283. //  stream by calling IShellBrowser::GetViewStateStream and store the
  1284. //  current view state into that stream.
  1285. //
  1286. //
  1287. // IShellView::SelectItem(pidlItem, uFlags)
  1288. //
  1289. //   The explorer calls this member to change the selection state of
  1290. //  item(s) within the shell view window.  If pidlItem is NULL and uFlags
  1291. //  is SVSI_DESELECTOTHERS, all items should be deselected.
  1292. //
  1293. //-------------------------------------------------------------------------
  1294.  
  1295. //
  1296. // uState values for IShellView::UIActivate
  1297. //
  1298. typedef enum ESVUIA_STATUS {
  1299.     SVUIA_DEACTIVATE       = 0,
  1300.     SVUIA_ACTIVATE_NOFOCUS = 1,
  1301.     SVUIA_ACTIVATE_FOCUS   = 2,
  1302.     SVUIA_INPLACEACTIVATE  = 3          // new flag for IShellView2
  1303. } ESVUIA_STATUS;
  1304.  
  1305. /*
  1306. [   odl,
  1307.     helpstring("Visual Basic version of IShellView interface"),
  1308.     uuid(000214E3-0000-0000-C000-000000000046)
  1309. ]
  1310. interface IVBShellView : IOleWindow {
  1311.     // *** IShellView methods ***
  1312.  
  1313.     HRESULT TranslateAccelerator(LPMSG lpmsg);
  1314.  
  1315. #ifdef _FIX_ENABLEMODELESS_CONFLICT
  1316.     HRESULT EnableModelessSV(BOOL fEnable);
  1317. #else
  1318.     HRESULT EnableModeless(BOOL fEnable);
  1319. #endif
  1320.  
  1321.     HRESULT UIActivate(UINT uState);
  1322.  
  1323.     HRESULT Refresh();
  1324.  
  1325.     HRESULT CreateViewWindow(IShellView  *lpPrevView,
  1326.                              LPCFOLDERSETTINGS lpfs,
  1327.                              IShellBrowser  * psb,
  1328.                              RECT * prcView,
  1329.                              HWND  *phWnd);
  1330.  
  1331.     HRESULT DestroyViewWindow)(THIS);
  1332.  
  1333.     HRESULT GetCurrentInfo(LPFOLDERSETTINGS lpfs);
  1334.  
  1335.     HRESULT AddPropertySheetPages(DWORD dwReserved,
  1336.                                   LPFNADDPROPSHEETPAGE lpfn,
  1337.                                   LPARAM lparam);
  1338.  
  1339.     HRESULT SaveViewState();
  1340.  
  1341.     HRESULT SelectItem(LPCITEMIDLIST pidlItem,
  1342.                        UINT uFlags);
  1343.  
  1344.     HRESULT GetItemObject(UINT uItem,
  1345.                           REFIID riid,
  1346.                           LPVOID ppv);
  1347. };
  1348. typedef IVBShellView *    LPSHELLVIEW;
  1349.  
  1350. typedef GUID SHELLVIEWID;
  1351.  
  1352. typedef struct _SV2CVW2_PARAMS {
  1353.         DWORD cbSize;
  1354.  
  1355.         IShellView *psvPrev;
  1356.         FOLDERSETTINGS const *pfs;
  1357.         IShellBrowser *psbOwner;
  1358.         RECT *prcView;
  1359.         SHELLVIEWID const *pvid;
  1360.  
  1361.         HWND hwndView;
  1362. } SV2CVW2_PARAMS;
  1363. typedef SV2CVW2_PARAMS *LPSV2CVW2_PARAMS;
  1364.  
  1365. [   odl,
  1366.     helpstring("Visual Basic version of IShellView2 interface"),
  1367.     uuid(88E39E80-3578-11CF-AE69-08002B2E1262)
  1368. ]
  1369. interface IShellView2 : IShellView {
  1370.     // *** IShellView2 methods ***
  1371.     HRESULT GetView(SHELLVIEWID* pvid, ULONG uView);
  1372.     HRESULT CreateViewWindow2(LPSV2CVW2_PARAMS lpParams);
  1373. };
  1374. */
  1375.  
  1376. //-------------------------------------------------------------------------
  1377. //
  1378. // struct STRRET
  1379. //
  1380. // structure for returning strings from IShellFolder member functions
  1381. //
  1382. //-------------------------------------------------------------------------
  1383.  
  1384. typedef enum ESTRRET {
  1385.     STRRET_WSTR     = 0,          // Use STRRET.pOleStr
  1386.     STRRET_OFFSET   = 1,          // Use STRRET.uOffset to Ansi
  1387.     STRRET_CSTR     = 2           // Use STRRET.cStr
  1388. } ESTRRET;
  1389.  
  1390. typedef struct STRRET
  1391. {
  1392.     ESTRRET uType; // One of the STRRET_* values
  1393.     /*
  1394.     union
  1395.     {
  1396.         LPWSTR          pOleStr;        // OLESTR that will be freed
  1397.         LPSTR           pStr;           // ANSI string that will be freed (needed?)
  1398.         UINT            uOffset;        // Offset into SHITEMID
  1399.         char            cStr[260];      // Buffer to fill in (ANSI)
  1400.     } DUMMYUNIONNAME;
  1401.     */
  1402.     BYTE cStr[260]; // MAX_PATH buffer to fill in (ANSI)
  1403. } STRRET;
  1404. typedef STRRET * LPSTRRET;
  1405. // typedef LONG LPSTRRET;
  1406.  
  1407.  
  1408. //-------------------------------------------------------------------------
  1409. //
  1410. // SHGetPathFromIDList
  1411. //
  1412. //  This function assumes the size of the buffer (MAX_PATH). The pidl
  1413. // should point to a file system object.
  1414. //
  1415. //-------------------------------------------------------------------------
  1416.  
  1417. // Moved to SHELLAPI.IDL
  1418.  
  1419. //-------------------------------------------------------------------------
  1420. //
  1421. // IEnumIDList interface
  1422. //
  1423. //  IShellFolder::EnumObjects member returns an IEnumIDList object.
  1424. //
  1425. //-------------------------------------------------------------------------
  1426.  
  1427. [   odl,
  1428.     helpstring("Visual Basic version of IShellBrowser interface"),
  1429.     uuid(000214F2-0000-0000-C000-000000000046)
  1430. ]
  1431. interface IVBEnumIDList : IUnknown {
  1432.     // *** IEnumIDList methods ***
  1433.  
  1434.     LONG Next(ULONG celt, LPITEMIDLIST *rgelt, ULONG *pceltFetched);
  1435.  
  1436.     LONG Skip(ULONG celt);
  1437.  
  1438.     LONG Reset();
  1439.  
  1440.     LONG Clone(IVBEnumIDList **ppenum);
  1441.  
  1442. };
  1443. typedef IVBEnumIDList      *LPENUMIDLIST;
  1444.  
  1445. //-------------------------------------------------------------------------
  1446. //
  1447. // IShellFolder interface
  1448. //
  1449. //
  1450. // [Member functions]
  1451. //
  1452. // IShellFolder::BindToObject(pidl, pbc, riid, ppvOut)
  1453. //   This function returns an instance of a sub-folder which is specified
  1454. //  by the IDList (pidl).
  1455. //
  1456. // IShellFolder::BindToStorage(pidl, pbc, riid, ppvObj)
  1457. //   This function returns a storage instance of a sub-folder which is
  1458. //  specified by the IDList (pidl). The shell never calls this member
  1459. //  function in the first release of Win95.
  1460. //
  1461. // IShellFolder::CompareIDs(lParam, pidl1, pidl2)
  1462. //   This function compares two IDLists and returns the result. The shell
  1463. //  explorer always passes 0 as lParam, which indicates "sort by name".
  1464. //  It should return 0 (as CODE of the scode), if two id indicates the
  1465. //  same object; negative value if pidl1 should be placed before pidl2;
  1466. //  positive value if pidl2 should be placed before pidl1.
  1467. //
  1468. // IShellFolder::CreateViewObject(hwndOwner, riid, ppvOut)
  1469. //   This function creates a view object of the folder itself. The view
  1470. //  object is a difference instance from the shell folder object.
  1471. //   "hwndOwner" can be used  as the owner window of its dialog box or
  1472. //      menu during the lifetime of the view object.
  1473. //  instance which has only one reference count. The explorer may create
  1474. //  more than one instances of view object from one shell folder object
  1475. //  and treat them as separate instances.
  1476. //
  1477. // IShellFolder::GetAttributesOf(cidl, apidl, prgfInOut)
  1478. //   This function returns the attributes of specified objects in that
  1479. //  folder. "cidl" and "apidl" specifies objects. "apidl" contains only
  1480. //  simple IDLists. The explorer initializes *prgfInOut with a set of
  1481. //  flags to be evaluated. The shell folder may optimize the operation
  1482. //  by not returning unspecified flags.
  1483. //
  1484. // IShellFolder::GetUIObjectOf(hwndOwner, cidl, apidl, riid, prgfInOut, ppvOut)
  1485. //   This function creates a UI object to be used for specified objects.
  1486. //  The shell explorer passes either IID_IDataObject (for transfer operation)
  1487. //  or IID_IContextMenu (for context menu operation) as riid.
  1488. //
  1489. // IShellFolder::GetDisplayNameOf
  1490. //   This function returns the display name of the specified object.
  1491. //  If the ID contains the display name (in the locale character set),
  1492. //  it returns the offset to the name. Otherwise, it returns a pointer
  1493. //  to the display name string (UNICODE), which is allocated by the
  1494. //  task allocator, or fills in a buffer.
  1495. //
  1496. // IShellFolder::SetNameOf
  1497. //   This function sets the display name of the specified object.
  1498. //  If it changes the ID as well, it returns the new ID which is
  1499. //  alocated by the task allocator.
  1500. //
  1501. //-------------------------------------------------------------------------
  1502.  
  1503. // IShellFolder::GetDisplayNameOf/SetNameOf uFlags
  1504. typedef enum ESHGDN
  1505. {
  1506.     SHGDN_NORMAL            = 0,        // default (display purpose)
  1507.     SHGDN_INFOLDER          = 1,        // displayed under a folder (relative)
  1508.     SHGDN_FORADDRESSBAR     = 0x4000,   // for displaying in the address (drives dropdown) bar
  1509.     SHGDN_FORPARSING        = 0x8000,   // for ParseDisplayName or path
  1510. } ESHGDN;
  1511.  
  1512. // IShellFolder::EnumObjects
  1513. typedef enum ESHCONTF
  1514. {
  1515.     SHCONTF_FOLDERS         = 32,       // for shell browser
  1516.     SHCONTF_NONFOLDERS      = 64,       // for default view
  1517.     SHCONTF_INCLUDEHIDDEN   = 128,      // for hidden/system objects
  1518. } ESHCONTF;
  1519.  
  1520. // IShellFolder::GetAttributesOf flags
  1521. typedef enum ESFGAO {
  1522.     SFGAO_CANCOPY           = 0x00000001,     // DROPEFFECT_COPY Objects can be copied
  1523.     SFGAO_CANMOVE           = 0x00000002,     // Objects can be moved
  1524.     SFGAO_CANLINK           = 0x00000004,     // Objects can be linked
  1525.     SFGAO_CANRENAME         = 0x00000010,     // Objects can be renamed
  1526.     SFGAO_CANDELETE         = 0x00000020,     // Objects can be deleted
  1527.     SFGAO_HASPROPSHEET      = 0x00000040,     // Objects have property sheets
  1528.     SFGAO_DROPTARGET        = 0x00000100,     // Objects are drop target
  1529.     SFGAO_CAPABILITYMASK    = 0x00000177,
  1530.     SFGAO_LINK              = 0x00010000,     // Shortcut (link)
  1531.     SFGAO_SHARE             = 0x00020000,     // shared
  1532.     SFGAO_READONLY          = 0x00040000,     // read-only
  1533.     SFGAO_GHOSTED           = 0x00080000,     // ghosted icon
  1534.     SFGAO_DISPLAYATTRMASK   = 0x000F0000,
  1535.     SFGAO_FILESYSANCESTOR   = 0x10000000,     // It contains file system folder
  1536.     SFGAO_FOLDER            = 0x20000000,     // It's a folder.
  1537.     SFGAO_FILESYSTEM        = 0x40000000,     // is a file system thing (file/folder/root)
  1538.     SFGAO_HASSUBFOLDER      = 0x80000000,     // Expandable in the map pane
  1539.     SFGAO_CONTENTSMASK      = 0x80000000,
  1540.     SFGAO_VALIDATE          = 0x01000000,     // invalidate cached information
  1541.     SFGAO_REMOVABLE         = 0x02000000,     // is this removeable media?
  1542.     SFGAO_COMPRESSED        = 0x04000000      // Object is compressed (use alt color)
  1543. } ESFGAO;
  1544.  
  1545. [   odl,
  1546.     helpstring("Visual Basic version of IShellFolder interface"),
  1547.     uuid(000214E6-0000-0000-C000-000000000046)
  1548. ]
  1549. interface IVBShellFolder : IUnknown {
  1550.     // *** IShellFolder methods ***
  1551.     HRESULT ParseDisplayName(HWND hwndOwner,
  1552.                              LONG /* LPBC */ pbcReserved,
  1553.                              LPOLESTR lpszDisplayName,
  1554.                              ULONG * pchEaten,
  1555.                              LPITEMIDLIST * ppidl,
  1556.                              ULONG *pdwAttributes);
  1557.  
  1558.     HRESULT EnumObjects(HWND hwndOwner,
  1559.                         ESHCONTF grfFlags,
  1560.                         LPENUMIDLIST * ppenumIDList);
  1561.  
  1562.     HRESULT BindToObject(LPCITEMIDLIST pidl,
  1563.                          LONG /* LPBC */ pbcReserved,
  1564.                          REFIID riid,
  1565.                          LPVOID ppvOut);
  1566.  
  1567.     HRESULT BindToStorage(LPCITEMIDLIST pidl,
  1568.                           LONG /* LPBC */ pbcReserved,
  1569.                           REFIID riid,
  1570.                           LPVOID ppvObj);
  1571.  
  1572.     HRESULT CompareIDs(LPARAM lParam,
  1573.                        LPCITEMIDLIST pidl1,
  1574.                        LPCITEMIDLIST pidl2);
  1575.  
  1576.     HRESULT CreateViewObject(HWND hwndOwner,
  1577.                              REFIID riid,
  1578.                              LPVOID ppvOut);
  1579.  
  1580.     HRESULT GetAttributesOf(UINT cidl,
  1581.                             LPCITEMIDLIST * apidl,
  1582.                             ESFGAO * rgfInOut);
  1583.  
  1584.     HRESULT GetUIObjectOf(HWND hwndOwner,
  1585.                           UINT cidl,
  1586.                           LPCITEMIDLIST * apidl,
  1587.                           REFIID riid,
  1588.                           UINT * prgfInOut,
  1589.                           LPVOID ppvOut);
  1590.  
  1591.     HRESULT GetDisplayNameOf(LPCITEMIDLIST pidl,
  1592.                              ESHGDN uFlags,
  1593.                              LPSTRRET lpName);
  1594.  
  1595.     HRESULT SetNameOf(HWND hwndOwner,
  1596.                       LPCITEMIDLIST pidl,
  1597.                       LPCOLESTR lpszName,
  1598.                       ESHCONTF uFlags,
  1599.                       LPITEMIDLIST * ppidlOut);
  1600. };
  1601. typedef IVBShellFolder * LPSHELLFOLDER;
  1602.  
  1603. //==========================================================================
  1604. // Clipboard format which may be supported by IDataObject from system
  1605. // defined shell folders (such as directories, network, ...).
  1606. //==========================================================================
  1607. /*
  1608. #define CFSTR_SHELLIDLIST       TEXT("Shell IDList Array")      // CF_IDLIST
  1609. #define CFSTR_SHELLIDLISTOFFSET TEXT("Shell Object Offsets")    // CF_OBJECTPOSITIONS
  1610. #define CFSTR_NETRESOURCES      TEXT("Net Resource")            // CF_NETRESOURCE
  1611. #define CFSTR_FILEDESCRIPTORA   TEXT("FileGroupDescriptor")     // CF_FILEGROUPDESCRIPTORA
  1612. #define CFSTR_FILEDESCRIPTORW   TEXT("FileGroupDescriptorW")    // CF_FILEGROUPDESCRIPTORW
  1613. #define CFSTR_FILECONTENTS      TEXT("FileContents")            // CF_FILECONTENTS
  1614. #define CFSTR_FILENAMEA         TEXT("FileName")                // CF_FILENAMEA
  1615. #define CFSTR_FILENAMEW         TEXT("FileNameW")               // CF_FILENAMEW
  1616. #define CFSTR_PRINTERGROUP      TEXT("PrinterFriendlyName")     // CF_PRINTERS
  1617. #define CFSTR_FILENAMEMAP       TEXT("FileNameMap")             // CF_FILENAMEMAP
  1618. #define CFSTR_PREFERREDDROPEFFECT TEXT("Preferred DropEffect")
  1619.  
  1620. #ifdef UNICODE
  1621. #define CFSTR_FILEDESCRIPTOR    CFSTR_FILEDESCRIPTORW
  1622. #define CFSTR_FILENAME          CFSTR_FILENAMEW
  1623. #else
  1624. #define CFSTR_FILEDESCRIPTOR    CFSTR_FILEDESCRIPTORA
  1625. #define CFSTR_FILENAME          CFSTR_FILENAMEA
  1626. #endif
  1627.  
  1628. //
  1629. // CF_OBJECTPOSITIONS
  1630. //
  1631. //
  1632.  
  1633.  
  1634.  
  1635. #define DVASPECT_SHORTNAME      2 // use for CF_HDROP to get short name version
  1636. //
  1637. // format of CF_NETRESOURCE
  1638. //
  1639. typedef struct NRESARRAY {     // anr
  1640.     UINT cItems;
  1641.     NETRESOURCE nr[1];
  1642. } NRESARRAY, * LPNRESARRAY;
  1643.  
  1644. //
  1645. // format of CF_IDLIST
  1646. //
  1647. typedef struct CIDA {
  1648.     UINT cidl;          // number of relative IDList
  1649.     UINT aoffset[1];    // [0]: folder IDList, [1]-[cidl]: item IDList
  1650. } CIDA, * LPIDA;
  1651. */
  1652.  
  1653. //
  1654. // FILEDESCRIPTOR.dwFlags field indicate which fields are to be used
  1655. //
  1656. typedef enum FD_FLAGS {
  1657.     FD_CLSID            = 0x0001,
  1658.     FD_SIZEPOINT        = 0x0002,
  1659.     FD_ATTRIBUTES       = 0x0004,
  1660.     FD_CREATETIME       = 0x0008,
  1661.     FD_ACCESSTIME       = 0x0010,
  1662.     FD_WRITESTIME       = 0x0020,
  1663.     FD_FILESIZE         = 0x0040,
  1664.     FD_LINKUI           = 0x8000,       // 'link' UI is prefered
  1665. } FD_FLAGS;
  1666.  
  1667. typedef struct FILEDESCRIPTOR { // fod
  1668.     DWORD dwFlags;
  1669.  
  1670.     CLSID clsid;
  1671.     SIZEL sizel;
  1672.     POINTL pointl;
  1673.  
  1674.     DWORD dwFileAttributes;
  1675.     CURRENCY ftCreationTime;
  1676.     CURRENCY ftLastAccessTime;
  1677.     CURRENCY ftLastWriteTime;
  1678.     DWORD nFileSizeHigh;
  1679.     DWORD nFileSizeLow;
  1680. #if UNICODE
  1681.     BYTE cFileName[ 260 * 2 /* MAX_PATH */ ];
  1682. #else
  1683.     BYTE cFileName[ 260 /* MAX_PATH */ ];
  1684. #endif
  1685. } FILEDESCRIPTOR, *LPFILEDESCRIPTOR;
  1686.  
  1687. typedef struct FILEDESCRIPTORO { // fod
  1688.     DWORD dwFlags;
  1689.  
  1690.     CLSID clsid;
  1691.     SIZEL sizel;
  1692.     POINTL pointl;
  1693.  
  1694.     DWORD dwFileAttributes;
  1695.     FILETIME ftCreationTime;
  1696.     FILETIME ftLastAccessTime;
  1697.     FILETIME ftLastWriteTime;
  1698.     DWORD nFileSizeHigh;
  1699.     DWORD nFileSizeLow;
  1700. #if UNICODE
  1701.     BYTE cFileName[ 260 * 2 /* MAX_PATH */ ];
  1702. #else
  1703.     BYTE cFileName[ 260 /* MAX_PATH */ ];
  1704. #endif
  1705. } FILEDESCRIPTORO, *LPFILEDESCRIPTORO;
  1706.  
  1707. //
  1708. // format of CF_FILEGROUPDESCRIPTOR
  1709. //
  1710. typedef struct FILEGROUPDESCRIPTOR { // fgd
  1711.      UINT cItems;
  1712.      FILEDESCRIPTOR fgd[1];
  1713. } FILEGROUPDESCRIPTOR, * LPFILEGROUPDESCRIPTOR;
  1714.  
  1715. //
  1716. // format of CF_HDROP and CF_PRINTERS, in the HDROP case the data that follows
  1717. // is a double null terinated list of file names, for printers they are printer
  1718. // friendly names
  1719. //
  1720. typedef struct DROPFILES {
  1721.    DWORD pFiles;                       // offset of file list
  1722.    POINT pt;                           // drop point (client coords)
  1723.    BOOL fNC;                           // is it on NonClient area
  1724.                                        // and pt is in screen coords
  1725.    BOOL fWide;                         // WIDE character switch
  1726. } DROPFILES, * LPDROPFILES;
  1727.  
  1728.  
  1729. //====== File System Notification APIs ===============================
  1730. //
  1731.  
  1732.  
  1733.  
  1734. //
  1735. //  File System Notification flags
  1736. //
  1737.  
  1738.  
  1739.  
  1740. #define SHCNE_RENAMEITEM          0x00000001L
  1741. #define SHCNE_CREATE              0x00000002L
  1742. #define SHCNE_DELETE              0x00000004L
  1743. #define SHCNE_MKDIR               0x00000008L
  1744. #define SHCNE_RMDIR               0x00000010L
  1745. #define SHCNE_MEDIAINSERTED       0x00000020L
  1746. #define SHCNE_MEDIAREMOVED        0x00000040L
  1747. #define SHCNE_DRIVEREMOVED        0x00000080L
  1748. #define SHCNE_DRIVEADD            0x00000100L
  1749. #define SHCNE_NETSHARE            0x00000200L
  1750. #define SHCNE_NETUNSHARE          0x00000400L
  1751. #define SHCNE_ATTRIBUTES          0x00000800L
  1752. #define SHCNE_UPDATEDIR           0x00001000L
  1753. #define SHCNE_UPDATEITEM          0x00002000L
  1754. #define SHCNE_SERVERDISCONNECT    0x00004000L
  1755. #define SHCNE_UPDATEIMAGE         0x00008000L
  1756. #define SHCNE_DRIVEADDGUI         0x00010000L
  1757. #define SHCNE_RENAMEFOLDER        0x00020000L
  1758. #define SHCNE_FREESPACE           0x00040000L
  1759. #define SHCNE_EXTENDED_EVENT      0x00080000L // Extended Event.
  1760.  
  1761. #define SHCNE_ASSOCCHANGED        0x08000000L
  1762.  
  1763. #define SHCNE_DISKEVENTS          0x0002381FL
  1764. #define SHCNE_GLOBALEVENTS        0x0C0D81E0L // Events that dont match pidls first
  1765. #define SHCNE_ALLEVENTS           0x7FFFFFFFL
  1766. #define SHCNE_INTERRUPT           0x80000000L // The presence of this flag indicates
  1767.                                             // that the event was generated by an
  1768.                                             // interrupt.  It is stripped out before
  1769.                                             // the clients of SHCNNotify_ see it.
  1770.  
  1771. #define SHCNEE_THEMECHANGED       0x00000001L  // The theme changed
  1772.  
  1773.  
  1774. // Flags
  1775. // uFlags & SHCNF_TYPE is an ID which indicates what dwItem1 and dwItem2 mean
  1776. #define SHCNF_IDLIST      0x0000        // LPITEMIDLIST
  1777. #define SHCNF_PATHA       0x0001        // path name
  1778. #define SHCNF_PRINTERA    0x0002        // printer friendly name
  1779. #define SHCNF_DWORD       0x0003        // DWORD
  1780. #define SHCNF_PATHW       0x0005        // path name
  1781. #define SHCNF_PRINTERW    0x0006        // printer friendly name
  1782. #define SHCNF_TYPE        0x00FF
  1783. #define SHCNF_FLUSH       0x1000
  1784. #define SHCNF_FLUSHNOWAIT 0x2000
  1785.  
  1786. #ifdef UNICODE
  1787. #define SHCNF_PATH      SHCNF_PATHW
  1788. #define SHCNF_PRINTER   SHCNF_PRINTERW
  1789. #else
  1790. #define SHCNF_PATH      SHCNF_PATHA
  1791. #define SHCNF_PRINTER   SHCNF_PRINTERA
  1792. #endif
  1793.  
  1794. // QueryContextMenu uFlags
  1795. typedef enum QUERYCONTEXTMENUFLAGS {
  1796.     CMF_NORMAL              = 0x00000000,
  1797.     CMF_DEFAULTONLY         = 0x00000001,
  1798.     CMF_VERBSONLY           = 0x00000002,
  1799.     CMF_EXPLORE             = 0x00000004,
  1800.     CMF_NOVERBS             = 0x00000008,
  1801.     CMF_CANRENAME           = 0x00000010,
  1802.     CMF_NODEFAULT           = 0x00000020,
  1803.     CMF_INCLUDESTATIC       = 0x00000040,
  1804.     CMF_RESERVED            = 0xffff0000,     // View specific
  1805.  
  1806.     // GetCommandString uFlags
  1807.     GCS_VERBA               = 0x00000000,     // canonical verb
  1808.     GCS_HELPTEXTA           = 0x00000001,     // help text (for status bar)
  1809.     GCS_VALIDATEA           = 0x00000002,     // validate command exists
  1810.     GCS_VERBW               = 0x00000004,     // canonical verb (unicode)
  1811.     GCS_HELPTEXTW           = 0x00000005,     // help text (unicode version)
  1812.     GCS_VALIDATEW           = 0x00000006,     // validate command exists (unicode)
  1813.     GCS_UNICODE             = 0x00000004      // for bit testing - Unicode string
  1814. } QUERYCONTEXTMENUFLAGS;
  1815.  
  1816. #ifdef UNICODE
  1817. #define GCS_VERB        GCS_VERBW
  1818. #define GCS_HELPTEXT    GCS_HELPTEXTW
  1819. #define GCS_VALIDATE    GCS_VALIDATEW
  1820. #else
  1821. #define GCS_VERB        GCS_VERBA
  1822. #define GCS_HELPTEXT    GCS_HELPTEXTA
  1823. #define GCS_VALIDATE    GCS_VALIDATEA
  1824. #endif
  1825.  
  1826. #define CMDSTR_NEWFOLDERA   "NewFolder"
  1827. #define CMDSTR_VIEWLISTA    "ViewList"
  1828. #define CMDSTR_VIEWDETAILSA "ViewDetails"
  1829. #define CMDSTR_NEWFOLDERW   L"NewFolder"
  1830. #define CMDSTR_VIEWLISTW    L"ViewList"
  1831. #define CMDSTR_VIEWDETAILSW L"ViewDetails"
  1832.  
  1833. #ifdef UNICODE
  1834. #define CMDSTR_NEWFOLDER    CMDSTR_NEWFOLDERW
  1835. #define CMDSTR_VIEWLIST     CMDSTR_VIEWLISTW
  1836. #define CMDSTR_VIEWDETAILS  CMDSTR_VIEWDETAILSW
  1837. #else
  1838. #define CMDSTR_NEWFOLDER    CMDSTR_NEWFOLDERA
  1839. #define CMDSTR_VIEWLIST     CMDSTR_VIEWLISTA
  1840. #define CMDSTR_VIEWDETAILS  CMDSTR_VIEWDETAILSA
  1841. #endif
  1842.  
  1843. #define CMIC_MASK_HOTKEY        SEE_MASK_HOTKEY
  1844. #define CMIC_MASK_ICON          SEE_MASK_ICON
  1845. #define CMIC_MASK_FLAG_NO_UI    SEE_MASK_FLAG_NO_UI
  1846. #define CMIC_MASK_UNICODE       SEE_MASK_UNICODE
  1847. #define CMIC_MASK_NO_CONSOLE    SEE_MASK_NO_CONSOLE
  1848. #define CMIC_MASK_HASLINKNAME   SEE_MASK_HASLINKNAME
  1849. #define CMIC_MASK_FLAG_SEP_VDM  SEE_MASK_FLAG_SEPVDM
  1850. #define CMIC_MASK_HASTITLE      SEE_MASK_HASTITLE
  1851. #define CMIC_MASK_ASYNCOK       SEE_MASK_ASYNCOK
  1852.  
  1853.  
  1854. // GetIconLocation() input flags
  1855.  
  1856. #define GIL_OPENICON     0x0001      // allows containers to specify an "open" look
  1857. #define GIL_FORSHELL     0x0002      // icon is to be displayed in a ShellFolder
  1858.  
  1859. // GetIconLocation() return flags
  1860.  
  1861. #define GIL_SIMULATEDOC  0x0001      // simulate this document icon for this
  1862. #define GIL_PERINSTANCE  0x0002      // icons from this class are per instance (each file has its own)
  1863. #define GIL_PERCLASS     0x0004      // icons from this class per class (shared for all files of this type)
  1864. #define GIL_NOTFILENAME  0x0008      // location is not a filename, must call ::ExtractIcon
  1865. #define GIL_DONTCACHE    0x0010      // this icon should not be cached
  1866.  
  1867.     // Define File View Show Info Flags.
  1868. #define FVSIF_RECT      0x00000001      // The rect variable has valid data.
  1869. #define FVSIF_PINNED    0x00000002      // We should Initialize pinned
  1870.  
  1871. #define FVSIF_NEWFAILED 0x08000000      // The new file passed back failed
  1872.                                         // to be viewed.
  1873.  
  1874. #define FVSIF_NEWFILE   0x80000000      // A new file to view has been returned
  1875. #define FVSIF_CANVIEWIT 0x40000000      // The viewer can view it.
  1876.  
  1877. //--------------------------------------------------------------------------
  1878. //
  1879. // Command/menuitem IDs
  1880. //
  1881. //  The explorer dispatches WM_COMMAND messages based on the range of
  1882. // command/menuitem IDs. All the IDs of menuitems that the view (right
  1883. // pane) inserts must be in FCIDM_SHVIEWFIRST/LAST (otherwise, the explorer
  1884. // won't dispatch them). The view should not deal with any menuitems
  1885. // in FCIDM_BROWSERFIRST/LAST (otherwise, it won't work with the future
  1886. // version of the shell).
  1887. //
  1888. //  FCIDM_SHVIEWFIRST/LAST      for the right pane (IShellView)
  1889. //  FCIDM_BROWSERFIRST/LAST     for the explorer frame (IShellBrowser)
  1890. //  FCIDM_GLOBAL/LAST           for the explorer's submenu IDs
  1891. //
  1892. //--------------------------------------------------------------------------
  1893.  
  1894. #define FCIDM_SHVIEWFIRST           0x0000
  1895. #define FCIDM_SHVIEWLAST            0x7fff
  1896. #define FCIDM_BROWSERFIRST          0xa000
  1897. #define FCIDM_BROWSERLAST           0xbf00
  1898. #define FCIDM_GLOBALFIRST           0x8000
  1899. #define FCIDM_GLOBALLAST            0x9fff
  1900.  
  1901. //
  1902. // Global submenu IDs and separator IDs
  1903. //
  1904. #define FCIDM_MENU_FILE             (FCIDM_GLOBALFIRST+0x0000)
  1905. #define FCIDM_MENU_EDIT             (FCIDM_GLOBALFIRST+0x0040)
  1906. #define FCIDM_MENU_VIEW             (FCIDM_GLOBALFIRST+0x0080)
  1907. #define FCIDM_MENU_VIEW_SEP_OPTIONS (FCIDM_GLOBALFIRST+0x0081)
  1908. #define FCIDM_MENU_TOOLS            (FCIDM_GLOBALFIRST+0x00c0)
  1909. #define FCIDM_MENU_TOOLS_SEP_GOTO   (FCIDM_GLOBALFIRST+0x00c1)
  1910. #define FCIDM_MENU_HELP             (FCIDM_GLOBALFIRST+0x0100)
  1911. #define FCIDM_MENU_FIND             (FCIDM_GLOBALFIRST+0x0140)
  1912. #define FCIDM_MENU_EXPLORE          (FCIDM_GLOBALFIRST+0x0150)
  1913. #define FCIDM_MENU_FAVORITES        (FCIDM_GLOBALFIRST+0x0170)
  1914.  
  1915. //--------------------------------------------------------------------------
  1916. // control IDs known to the view
  1917. //--------------------------------------------------------------------------
  1918.  
  1919. #define FCIDM_TOOLBAR      (FCIDM_BROWSERFIRST + 0)
  1920. #define FCIDM_STATUS       (FCIDM_BROWSERFIRST + 1)
  1921. //
  1922. // Values for wFlags parameter of ISB::BrowseObject() member.
  1923. //
  1924. #define SBSP_DEFBROWSER  0x0000
  1925. #define SBSP_SAMEBROWSER 0x0001
  1926. #define SBSP_NEWBROWSER  0x0002
  1927.  
  1928. #define SBSP_DEFMODE     0x0000
  1929. #define SBSP_OPENMODE    0x0010
  1930. #define SBSP_EXPLOREMODE 0x0020
  1931.  
  1932. #define SBSP_ABSOLUTE    0x0000
  1933. #define SBSP_RELATIVE    0x1000
  1934. #define SBSP_PARENT      0x2000
  1935.  
  1936. #define SBSP_INITIATEDBYHLINKFRAME        0x80000000
  1937. #define SBSP_REDIRECT                     0x40000000
  1938.  
  1939. //
  1940. // Values for id parameter of ISB::GetWindow/SendControlMsg members.
  1941. //
  1942. // WARNING:
  1943. //  Any shell extensions which sends messages to those control windows
  1944. // might not work in the future version of windows. If you really need
  1945. // to send messages to them, (1) don't assume that those control window
  1946. // always exist (i.e. GetControlWindow may fail) and (2) verify the window
  1947. // class of the window before sending any messages.
  1948. //
  1949. #define FCW_STATUS      0x0001
  1950. #define FCW_TOOLBAR     0x0002
  1951. #define FCW_TREE        0x0003
  1952.  
  1953. //
  1954. // Values for uFlags paremeter of ISB::SetToolbarItems member.
  1955. //
  1956. #define FCT_MERGE       0x0001
  1957. #define FCT_CONFIGABLE  0x0002
  1958. #define FCT_ADDTOEND    0x0004
  1959.  
  1960. #define CDBOSC_SETFOCUS     0x00000000
  1961. #define CDBOSC_KILLFOCUS    0x00000001
  1962. #define CDBOSC_SELCHANGE    0x00000002
  1963. #define CDBOSC_RENAME       0x00000003
  1964.  
  1965. //
  1966. // shellview select item flags
  1967. //
  1968. #define SVSI_DESELECT   0x0000
  1969. #define SVSI_SELECT     0x0001
  1970. #define SVSI_EDIT       0x0003  // includes select
  1971. #define SVSI_DESELECTOTHERS 0x0004
  1972. #define SVSI_ENSUREVISIBLE  0x0008
  1973. #define SVSI_FOCUSED        0x0010
  1974.  
  1975. //
  1976. // shellview get item object flags
  1977. //
  1978. #define SVGIO_BACKGROUND    0x00000000
  1979. #define SVGIO_SELECTION     0x00000001
  1980. #define SVGIO_ALLVIEW       0x00000002
  1981.  
  1982. #define SV2GV_CURRENTVIEW ((UINT)-1)
  1983. #define SV2GV_DEFAULTVIEW ((UINT)-2)
  1984.